<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui" 
	template="/templates/layout.xhtml">
	<ui:define name="head">    
	<style type="text/css">
	    .ui-diagram-element {   
	        width:6em; 
	        height:4em;     
	        line-height:4em;
	        font-size: 16px;
	        font-weight: bold;
	        text-align: center;
	        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.8);
	        border-radius: 4em;
	        border: 1px solid transparent;
	        background-color: #40E0D0;
	        color: #ffffff;
	    }
	    .ui-diagram-element:hover {
	        background-color: #D3D3D3;
	    }
	    
	    .flow-label {
	        font-size: 15px;
	        color: #816A51;
	    }
	    .ui-diagram-start {
			background-color: #8B0000;
			color: #ffffff;
			border-color: #7ab02c;
		}
		.ui-diagram-end {
			background-color: #8B0000;
			color: #ffffff;
			border-color: #7ab02c;
		}	 
		 .ui-diagram-focus {
			background-color: #00db00;
			font-weight: bold;
			color: blue;
			border-color: #00db00;
		}
	    .ui-diagram-success {
	        background-color: #9CB071;
	        color: #ffffff;
	        border-color: #7ab02c;
	    }	 
	    .ui-diagram-fail {
	        background-color: #C34A2C;
	        color: #ffffff;
	    }
	</style>
	</ui:define>
	<ui:define name="ptitle">流程查询</ui:define>
	<ui:define name="pcontent">
		<h:form id="frm">
			<p:growl id="messages" showDetail="true" />
			<p:panel id="flowquery" header="流程查看、启动流程实例" style="margin-bottom:5px">
				<h:panelGrid columns="5" cellspacing="10">
					<p:outputLabel value="流程显示名称："></p:outputLabel>
					<p:inputText value="#{wfmProcessMgrMB.flowDisplayName}"></p:inputText>
					<p:commandButton value="查询" icon="ui-icon-search"
						update=":frm:dtFlow" action="#{wfmProcessMgrMB.queryFlowList}">
						<f:setPropertyActionListener value="#{appShiroValidate.userno}"
							target="#{wfmProcessMgrMB.operator}" />
					</p:commandButton>
				</h:panelGrid>

				<h:panelGrid>
					<p:dataTable id="dtFlow" var="row" value="#{wfmProcessMgrMB.voList}" 
						rows="10" paginator="true" paginatorPosition="bottom"
						rowsPerPageTemplate="5,10,15"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">

						<f:facet name="header">
						      	流程查询
       					</f:facet>
						<p:column headerText="ID">
							<h:outputText value="#{row.id}" />
						</p:column>
						<p:column headerText="名称">
							<h:outputText value="#{row.name}" />
						</p:column>
						<p:column headerText="显示名称">
							<h:outputText value="#{row.displayName}" />
						</p:column>
						<p:column headerText="状态">
							<h:outputText value="#{row.state == 0 ? '启用' : '禁用'}&nbsp;" />
						</p:column>
						<p:column headerText="版本">
							<h:outputText value="#{row.version}&nbsp;" />
						</p:column>
						<p:column headerText="操作" style="width:240px;">
							<p:commandButton icon="ui-icon-flag" value="启" title="启动流程实例"
								update=":frm:flowDetailPanel :frm:messages"
								action="#{wfmProcessMgrMB.handleStartProcess}"
								rendered="#{ row.state == 0 }">
								<f:setPropertyActionListener value="#{row}"
									target="#{wfmProcessMgrMB.selectedProcess}" />
							</p:commandButton>
							<p:commandButton icon="ui-icon-search" value="查" title="查看流程"
								update=":frm:flowDetailPanel :frm:messages"
								action="#{wfmProcessMgrMB.handleShowProcess}">
								<f:setPropertyActionListener value="#{row}"
									target="#{wfmProcessMgrMB.selectedProcess}" />
							</p:commandButton>
						</p:column>

					</p:dataTable>
				</h:panelGrid>
			</p:panel>
			<p:panel id="flowDetailPanel" header="流程图示" style="margin-bottom:5px">
				<p:panelGrid rendered="#{not empty wfmProcessMgrMB.selectedProcess}">
					<p:diagram value="#{wfmProcessMgrMB.model}" style="height:400px" styleClass="ui-widget-content" />				
				</p:panelGrid>
			</p:panel>

		</h:form>
	</ui:define>

</ui:composition>

